This repository has no description
semble
/
src
/
webapp
/
app
/
(dashboard)
/
profile
/
[handle]
/
(withoutHeader)
/
collections
/
[rkey]
/
layout.tsx
2.1 kB
66 lines
1import BackButton from '@/components/navigation/backButton/BackButton';
2import Header from '@/components/navigation/header/Header';
3import { getCollectionPageByAtUri } from '@/features/collections/lib/dal';
4import type { Metadata } from 'next';
5import { Fragment, Suspense } from 'react';
6import CollectionHeader from '@/features/collections/components/collectionHeader/CollectionHeader';
7import CollectionHeaderSkeleton from '@/features/collections/components/collectionHeader/Skeleton.CollectionHeader';
8import CollectionShareHeaderButton from '@/features/collections/components/CollectionShareHeaderButton/CollectionShareHeaderButton';
9import CollectionTabs from '@/features/collections/components/collectionTabs/CollectionTabs';
10import { Container } from '@mantine/core';
11
12interface Props {
13 params: Promise<{ rkey: string; handle: string }>;
14 children: React.ReactNode;
15}
16
17export async function generateMetadata({ params }: Props): Promise<Metadata> {
18 const { rkey, handle } = await params;
19
20 const collection = await getCollectionPageByAtUri({
21 recordKey: rkey,
22 handle: handle,
23 });
24
25 return {
26 title: `${collection.name} (by ${collection.author.name})`,
27 description:
28 collection.description ??
29 `View ${collection.author.name}'s collection on Semble`,
30 authors: [
31 {
32 name: collection.author.name,
33 url: `${process.env.APP_URL}/profile/${handle}`,
34 },
35 ],
36 alternates: {
37 types: {
38 '': `${collection.uri}`,
39 },
40 },
41 other: {
42 'atprotocol:creator': `at://${collection.author.id}`,
43 },
44 };
45}
46
47export default async function Layout(props: Props) {
48 const { handle, rkey } = await props.params;
49
50 return (
51 <Fragment>
52 <Header>
53 <BackButton />
54 <CollectionShareHeaderButton handle={handle} rkey={rkey} />
55 </Header>
56 <Suspense fallback={<CollectionHeaderSkeleton />}>
57 <CollectionHeader handle={handle} rkey={rkey} />
58 </Suspense>
59
60 <Container size={'xl'} px={'xs'} mt={'md'}>
61 <CollectionTabs handle={handle} rkey={rkey} />
62 </Container>
63 {props.children}
64 </Fragment>
65 );
66}